<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no">
    <!-- Start of Baidu Transcode -->
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <meta name="applicable-device" content="pc,mobile">
    <meta name="MobileOptimized" content="width"/>
    <meta name="HandheldFriendly" content="true"/>
    <meta name="mobile-agent" content="format=html5;">
    <!-- End of Baidu Transcode -->

    <meta name="description" content="欢迎来到西安交大深圳MEM2018年会现场！">

    <!-- Apple -->
    <meta name="apple-mobile-web-app-title" content="西安交大深圳MEM2018年会">
    <title>西安交大深圳MEM2018年会</title>
    <link rel="stylesheet" media="all" href="index.css"/>

    <link rel="stylesheet" media="all" href="style.css"/>

    <script src="jquery-1.8.0.js"></script>
    <script src="jquery.form.js"></script>

    <style type="text/css">

    </style>

</head>

<body class="no-padding reader-black-font" lang="zh-CN">
<div class="sign">
    <div class="main">
        <h4 class="title">
            <div class="normal-title">
                <a id="js-sign-btn" class="" href="sign.html">签到</a>
                <b>·</b>
                <a id="js-speak-btn" class="" href="speak.html">发弹幕</a>
                <b>·</b>
                <a id="js-contribute-btn" class="active" href="javascript:void 0">赞助</a>
            </div>
        </h4>
        <div class="js-sign-up-container">
            <form class="new_user" id="new_user"
                  accept-charset="UTF-8" method="post">
                <div class="input-prepend restyle">
                    <input placeholder="赞助人姓名" type="text" value="" name="name" required id="user_username"/>
                </div>

                <div class="input-prepend restyle no-radius js-normal">
                    <input placeholder="手机号" type="tel" name="mobile" required id="user_mobile_number"/>
                </div>
                <div class="input-prepend">
                    <input placeholder="赞助金额" type="text" name="amount" required id="user_amount"/>
                </div>

                <div class="input-prepend">
                    <input placeholder="备注" type="text" name="remark" id="user_remark"/>
                </div>
                <input type="submit" value="提交" class="sign-up-button" id="submitBtn" data-disable-with="提交"/>
                <div id="alertDiv" class="alert alert-info text-left" style="display: none;color:green;">
                    Indicates a neutral informative change or action.
                </div>
            </form>
        </div>
    </div>
</div>
<script src="base.js"></script>
<script type="text/javascript">
    // wait for the DOM to be loaded
    //    action="http://www.thoughtmocks.com:8080/api/prize/donation"
    var options = {
            url: baseUrl + "prize/donation",
            success: function (data) {
//                var resultJson = JSON.parse(data);
                var resultJson = data;
                if (resultJson.result == true) {
                    //alert("Thank you for your comment!");
                    $("#user_remark").val("")
                    $("#user_amount").val("")
                    $("#user_mobile_number").val("")
                    $("#user_username").val("")
                    $("#alertDiv").text("提交成功！")
                    $("#alertDiv").show()
                }
                else {
                    $("#alertDiv").text(resultJson.msg)
                    $("#alertDiv").show()
                }
            }
            ,
            error: function (data) {
                $("#user_remark").val("")
                $("#user_amount").val("")
                $("#user_mobile_number").val("")
                $("#user_username").val("")
                $("#alertDiv").text("提交成功！")
                $("#alertDiv").show()
            }
        }
    ;

    $(document).ready(function () {
        $('#new_user').ajaxForm(options);
    });
</script>
</body>
</html>